<template>
  <div>
    <div class="login-box">
      <div class="form-box">
        <div class="title">
          <div class="title-content">绑定账号</div>
        </div>
        <van-form>
          <div class="phone">
            <van-row>手机号/登录账号</van-row>
          </div>
          <van-field
            v-model="AccountCode"
            class="login-input"
            :rules="[{ required: true, message: '请填写用户名' }]"
          />
          <div class="password">
            <van-row>密码</van-row>
          </div>
          <van-field
            v-model="Password"
            type="password"
            class="login-input"
            :rules="[{ required: true, message: '请填写密码' }]"
          />

          <div style="margin: 20px">
            <eagle-button class="br-5" block type="info" @click="onSubmit"
              >提交</eagle-button
            >
          </div>
        </van-form>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      AccountCode: "",
      Password: "",
      code: "",
    };
  },
  created() {
    if (this.$route.query.code) {
      this.code = this.$route.query.code;
    }
  },
  methods: {
    onSubmit() {
      this.bindOpenID();
    },
    bindOpenID() {
      let params = { AccountCode: this.AccountCode,Password:this.Password,Code: this.code };
      this.$axios.post("/Public/BindWXOpenId", params).then((res) => {
        if (res.success) {
          this.$router.push({
            path: "/followSuccess",
            query: {
              code: this.code,
              accountCode:this.AccountCode,
            },
          });
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
.login-box {
  box-shadow: 2px 2px 6px #ccc;
//   border-radius: 20px;
  background-color: #ffffff;
  height: 100vh;
  position: relative;
}

.form-box {
  padding: 20px 20px 20px 20px;
  .phone {
    padding-left: 12px;
    margin-bottom: 10px;
  }
  .password {
    padding: 10px 0 10px 12px;
  }
}

.title{
    height: 3rem;   
}

.title-content{
  font-size: 18pt;
  text-align: center;
}

/deep/ .van-cell::after{
  border-bottom:0;
}
</style>